<?php
import('Psg.Core');
import('Psg.Messages');
?>
<h1>
    Wiadomość od użytkownika <?= \Psg\Core::getUserInfo(\Psg\Core::getUserMailById($viewParams['from']))['nick'] ?>
</h1>
<p class="notice">
    <a href="<?= Url::site('messages/' . $viewParams['mailbox']) ?>">
        Powrót do skrzynki <?= ($viewParams['mailbox'] == 'inbox') ? 'nadawczej' : 'odbiorczej' ?>
    </a>
</p>
<fieldset>
    <legend><strong>Temat: <?= $viewParams['topic'] ?></strong>
        &emsp;|&emsp;Wysłana <?= $viewParams['time'] ?>
        &emsp;|&emsp;<a href="<?= Url::site('messages/delete/' . $viewParams['mailbox'] . '/' . $viewParams['id']) ?>">usuń</a>&emsp;</legend>
    <p class="messageBox">
        <?= Psg\Messages::formatMessage($viewParams['message']) ?>
    </p>
    <form class="rText" action="<?= Url::site('forms') ?>" method="post">
        <input type="hidden" name="_ACTION" value="messages"/>
        <input type="hidden" name="_EXECUTE" value="replyTo"/>
        <input type="hidden" name="topic" value="<?= $viewParams['topic'] ?>"/>
        <input type="hidden" name="uid" value="<?= $viewParams['from'] ?>"/>
        <button type="submit">
            Odpowiedz na wiadomość
        </button>
    </form>
</fieldset>